<div id="nav"> 
  <div id="nav_main">	
    <ul id="nav-menu-1">
      <% main_menus.each_with_index do |menu, index| %>
        <li "<%= current_menu == index ? 'id = \'current\'' : "" %>"
        class="first <%= navigation_class(index, main_menus.size) %>">

        <%= link_to menu.title, menu.link %>

        <% if menu.link =~ /\/main\/catalog/ %>
          <ul>
            <% Category.house_type_name_equals(["rent", "all"]).descend_by_created_at.all.each do |c| %>
              <li class='second'>
                <%= link_to c.title, catalog_path(:query => {:category_id => c.id}) %>
              </li>
            <% end %>
          </ul>
        <% elsif menu.link =~ /\/main\/sale_catalog/ %>
          <ul>
            <% Category.house_type_name_equals(["sale", "all"]).descend_by_created_at.all.each do |c| %>
              <li class='second'>
                <%= link_to c.title, sale_catalog_path(:query => {:category_id => c.id}) %>
              </li>
            <% end %>
          </ul>
        <% end %>
        </li>
      <% end %>
    </ul>

    <div class="clearer"></div>
  </div>
</div>